//
//  MHandleCardViewController.m
//  NeusoftHBSJSober
//
//  Created by Apple-21 on 15/11/9.
//  Copyright (c) 2015年 com.neusoftsober. All rights reserved.
//

#import "MHandleCardViewController.h"
#import "QRCodeGenerator.h"
#import "MDDataBaseUtil.h"
@interface MHandleCardViewController () {

}

- (IBAction)backAction:(UIButton *)sender;
@property (weak, nonatomic) IBOutlet UIView *contentView;
@property (weak, nonatomic) IBOutlet UILabel *accountLabel;
@property (weak, nonatomic) IBOutlet UILabel *IDLabel;
@property (weak, nonatomic) IBOutlet UIImageView *codeImageView;
@property (nonatomic) int index;
@end

@implementation MHandleCardViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.contentView.layer setCornerRadius:5.0];
    [self.contentView.layer setMasksToBounds:YES];
    self.accountLabel.text = [MDDataBaseUtil userLoginName];
    self.IDLabel.text = [MDDataBaseUtil userID];
    [self twoCodeImageView];
    
}
- (void)twoCodeImageView {

    self.codeImageView.image = [QRCodeGenerator qrImageForString:[self generateCodeStringByIndex:0] imageSize:self.codeImageView.frame.size.width];
}
- (NSString *)generateCodeStringByIndex:(int)index {

    NSString *codeString;
    switch (index) {
        case 0:
            codeString = [NSString stringWithFormat:@"index=%d&userID=%@&userLoginName=%@&userUIN=%@",index,[MDDataBaseUtil userID],[MDDataBaseUtil userLoginName],@""];
            break;
        case 1:
//            [MDDataBaseUtil setUuid:[self uuid]];
//            codeString = [NSString stringWithFormat:@""]
            break;
        default:
            break;
    }
    
    return codeString;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)backAction:(UIButton *)sender {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
